IF OBJECT_ID('dbo.GetParentName', 'FN') IS NOT NULL
    DROP FUNCTION dbo.GetParentName